package com.taobao.message.feignclient;

import com.taobao.base.model.RestResponse;
import com.taobao.message.model.dto.UserDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Slf4j
@Component
public class UserServiceClientFallbackFactory implements FallbackFactory<UserServiceClient> {

    @Override
    public UserServiceClient create(Throwable cause) {

        return new UserServiceClient() {

            @Override
            public RestResponse<UserDto> getUserById(String tbId) {

                log.error("调用用户服务失败，原因：{}",cause);
                return null;
            }
        };
    }
}
